namespace DataClasses
{
    using System;

    /// <summary>
    /// Just a connectional class for both playlist and song
    /// </summary>
    public class PlaylistSong : ActiveRecord<PlaylistSong>
    {
        private Guid _idPlaylist;
        private Guid _idSong;


        /// <summary>
        /// Empty constructor of the playlistsong
        /// </summary>
        public PlaylistSong() { }

        /// <summary>
        /// Simple constructor of playlistsong
        /// </summary>
        /// <param name="playlist"></param>
        /// <param name="song"></param>
        public PlaylistSong(Guid playlist, Guid song)
        {
            Id = Guid.NewGuid();
            _idPlaylist = playlist;
            _idSong = song;
            Save();
        }

        /// <summary>
        /// Kepps id of playlist
        /// </summary>
        public Guid IdPlaylist
        {
            get { return _idPlaylist; }
            set { _idPlaylist = value; }
        }

        /// <summary>
        /// Keeps id of song
        /// </summary>
        public Guid IdSong
        {
            get { return _idSong; }
            set { _idSong = value; }
        }

        public override object[] Objparams
        {
            get
            {
                objects = new object[3];
                objects[0] = Id.ToString();
                objects[1] = _idSong.ToString();
                objects[2] = _idPlaylist.ToString();
                return objects;
            }

            set
            {
                objects = value;
                Id = new Guid((string)objects[0]);
                _idSong = new Guid((string)objects[1]);
                _idPlaylist = new Guid((string)objects[2]);
            }
        }
    }
}
